
<template>
  <div  class="main-div">
    <Row>
      <Col span="24">
        <Card  dis-hover class="task-card">
          <div class="app-container">
            <el-row class="margin:30px;">
              <el-col>
                <el-table
                  :data="tableData"
                  size="mini"
                  style="width: 100%"
                  :height="tableHeight"
                  border
                >




                  <el-table-column type="expand" fixed label="详情" width="60">
                    <template slot-scope="props">
                      <el-form label-width="80px"  class="demo-table-expand">
                        <el-form-item label="批次号">
                          <span>{{ props.row.batchId }}</span>
                        </el-form-item>
                        <el-form-item label="命令类">
                          <span>{{ props.row.className }}</span>
                        </el-form-item>
                        <el-form-item label="调用次数">
                          <span>{{ props.row.count }}</span>
                        </el-form-item>
                      </el-form>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="name"
                    label="操作类型"
                  >
                  </el-table-column>
                  <el-table-column
                    prop="startTime"
                    label="开始时间"
                    show-overflow-tooltip
                    >
                  </el-table-column>
                  <el-table-column
                    prop="endTime"
                    label="结束时间"
                    show-overflow-tooltip
                  >

                  </el-table-column>

                  <el-table-column
                    prop="averageDatabaseExecutionTimePercentage"
                    label="数据库平均执行时间(毫秒)"
                    show-overflow-tooltip
                  >
                  </el-table-column>


                </el-table>
              </el-col>
            </el-row>
            <el-row type="flex" justify="center">
              <el-pagination
                background
                @current-change="handleCurrentChange"
                :current-page="queryForm.page"
                :page-size="queryForm.pageSize"
                layout="total, prev, pager, next, jumper"
                :total="total">
              </el-pagination>
            </el-row>



          </div>
        </Card>
      </Col>


    </Row>


    <Row>
      <Col span="24">
      <footer></footer>
      </Col>
    </Row>
  </div>

</template>

<script>
  import {getCmdLog} from "@/api/analy";
  import Footer from '../../../common/footer';

  export default {
    name: 'Task',
    components:{
      Footer
    },

    data() {
      return {
        tableData: [],
        tableHeight: 450,
        queryDate:[],
        total: 0,
        chartVisible: false,
        forbiddenSwitch: false,
        modal_loading: false,
        msgModal:false,
        delMsgModal:false,
        delMsgModalId:"",
        chartData: {},
        sellerId: 0,
        shopName: [],
        messageTemplate:{},
        queryForm: {
          page: 0,
          limit: 10,
        },
        categoryData: [
        ]
      }
    },
    mount() {
      this.getData()
      this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop
    },
    created() {
      this.getData()
    },
    methods: {
      openMsgDialog:function(id){
        //加载数据
        getMessageTemplateById(id).then((response) => {
          this.messageTemplate = response.data
        })
         this.msgModal=true;
      },
      delMsg:function(id){
        //加载数据
        this.delMsgModalId=id;
        this.delMsgModal=true
      },
      queryFormCreateTime:function(e){
        this.queryForm.tmpCreateTime=e;
      },
      queryFormEndTime:function(e){
        this.queryForm.tmpEndTime=e;
      },
      queryMethod:function(){
       var name=  this.queryForm.name;
       var tmpCreateTime=  this.queryForm.tmpCreateTime;
       if (tmpCreateTime ){
         if (tmpCreateTime[0]){
           this.queryForm.createTime=tmpCreateTime[0]+" - "+tmpCreateTime[1];
         }
       }
        getInstanceList(this.queryForm).then((response) => {
          this.tableData = response.data

          this.total = parseInt(response.count);

        })

      },

      getData: function () {
        getCmdLog(this.queryForm).then((response) => {
          this.tableData = response.data
          this.total = parseInt(response.count);

        })
      },
      handleCurrentChange(val) {
        this.queryForm.page = val
        this.getData()
      },
      search() {
        this.queryForm.page = 0
        this.queryMethod()
      },
      reset() {
        this.queryForm.name = "";
        this.queryForm.queryForm = "";
        this.queryForm.whereSql = "";
        this.queryForm.subject = "";
        this.queryForm.procDefName = "";
        this.queryForm.tmpCreateTime = "";
        this.queryForm.tmpEndTime = "";
        this.queryForm.createTime = "";
        this.queryForm.endTime = "";
        this.queryDate = [];
        this.getData()
      }

    }

  }

</script>
<style lang="scss" scoped>
  .main-div {
    background-color: #f3f3f3!important;
  }
.task-card{
  margin-top: 10px;
}

</style>
